<?php
class Pageley_Commerce_Command_GetCategory extends Pageley_Controller_Command_TransactionalRead {

	private $categoryId;

	public function setCategoryId($categoryId) {
		$this->categoryId = $categoryId;
	}

	protected function executeInternal() {
		$unitOfWork = $this->getUnitOfWork();
		$category = $unitOfWork->find(Pageley_Commerce_Domain_Category::type(),
			$this->categoryId);
		$model = new Pageley_Util_ArrayMap();
		$model->put(Pageley_Commerce_Request::CATEGORY, $category);
		return new Pageley_Controller_ModelAndView($model);
	}
}